package com.l024.easyandroidlib.http.response;

/**
 * @Author: Cat
 * @CreateTime: 2022-07-29  10:41
 * @Description: 网络请求结果 基类
 * @Version: 1.0
 */
public class BaseResponse<T> {
    public int errorCode;
    public String errorMsg;
    public T data;
    public boolean isSuccess(){
        return errorCode == 0;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "BaseResponse{" +
                "errorCode=" + errorCode +
                ", errorMsg='" + errorMsg + '\'' +
                ", data=" + (data==null?"":data) +
                '}';
    }
}